<?php

namespace App\Services\Game;
use App\DTOS\Admin\WhiteListDTO;
use App\Models\Game\WhiteList;

class WhiteListService
{
    public function paginate(WhiteListDTO $DTO){
        $model = WhiteList::query();
        $page = $DTO->getPage();
        $pageSize = $DTO->getLimit();
        $customerId = $DTO->getCustomerId();
        global $gameArea;
        $gameArea = $customerId;
        $serverId = $DTO->getServerId();
        if ($customerId){
            $model->where('customer_id',$customerId);
        }
        $model->where('game_area',$serverId);
        return $model->orderByDesc('id')->paginate($pageSize,'*','page',$page);
    }
}

